<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.net.*,web1.bean.COOKY" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>获取cookie</title>
</head>
<body>
每隔1s 刷新一下网页，观察网页效果
<%
response.setIntHeader("Refresh", 4);
//获取cookies的数据,是一个数组 
Cookie[] cookies=request.getCookies();
Cookie cookie=COOKY.getCookieByName(cookies, "name");
if(cookie!=null){
	out.println("<h2>"+URLDecoder.decode(cookie.getValue(), "utf-8")+"</h2>");
}
else{
	out.println("<h2>没有发现 Cookie</h2>");
}

%>
<a href="javascript:history.go(-1);"> 返回</a>
</body>
</html>
